package cn.ydxlm.maplib.entity;

import java.io.Serializable;

public class Location implements Serializable {
    public static final int SUCCESS = 0;
    private double latitude;
    private double longitude;
    //获取定位精度，默认值为0.0f
    private float radius;
    //方向
    private float direction;
    private int errorCode;
    private String errorDesc;
    private String street;
    private String city;
    private String province;
    private String area;
    private String name;
    private String adCode;

    public Location () {
    }

    public Location (double latitude, double longitude, int errorCode, String errorDesc) {
        this.latitude = latitude;
        this.longitude = longitude;
        this.errorCode = errorCode;
        this.errorDesc = errorDesc;
    }

    public String getProvince () {
        return province;
    }

    public void setProvince (String province) {
        this.province = province;
    }

    public String getArea () {
        return area;
    }

    public void setArea (String area) {
        this.area = area;
    }

    public String getName () {
        return name;
    }

    public void setName (String name) {
        this.name = name;
    }

    public String getAdCode () {
        return adCode;
    }

    public void setAdCode (String adCode) {
        this.adCode = adCode;
    }

    public float getDirection () {
        return direction;
    }

    public void setDirection (float direction) {
        this.direction = direction;
    }

    public String getCity () {
        return city;
    }

    public void setCity (String city) {
        this.city = city;
    }

    public String getStreet () {
        return street;
    }

    public void setStreet (String street) {
        this.street = street;
    }

    public double getLatitude () {
        return latitude;
    }

    public void setLatitude (double latitude) {
        this.latitude = latitude;
    }

    public double getLongitude () {
        return longitude;
    }

    public void setLongitude (double longitude) {
        this.longitude = longitude;
    }

    public float getRadius () {
        return radius;
    }

    public void setRadius (float radius) {
        this.radius = radius;
    }

    public int getErrorCode () {
        return errorCode;
    }

    public void setErrorCode (int errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorDesc () {
        return errorDesc;
    }

    public void setErrorDesc (String errorDesc) {
        this.errorDesc = errorDesc;
    }

    public boolean isSuccess () {
        return latitude > 1 && latitude < 180 && longitude > 1 && longitude < 180;
    }


    @Override
    public String toString () {
        return "Location{" +
                "latitude=" + latitude +
                ", longitude=" + longitude +
                ", radius=" + radius +
                ", direction=" + direction +
                ", errorCode=" + errorCode +
                ", errorDesc='" + errorDesc + '\'' +
                ", street='" + street + '\'' +
                ", city='" + city + '\'' +
                ", province='" + province + '\'' +
                ", area='" + area + '\'' +
                ", name='" + name + '\'' +
                ", adCode='" + adCode + '\'' +
                '}';
    }
}
